Provide the ability to delete (remove) HDF5 files at the end of integration tests#157
Provide the ability to delete (remove) HDF5 files at the end of integration tests#157bieryAtFnal wants to merge 9 commits into
Conversation
…o help make their meaning more clear.
…y to allow users to request that the HDF5 files created in integtests get removed at the end of the test.
…e used by many/all integtests to accomplish common functionality. It will take over basic_checks.py
…figResult attribute names and store the value of the --remove-hdf5-files command-line option in the run_dunerc result so that it can be used by integtests and utility_functions::remove_hdf5_files_if_requested()
…hdf5_files_if_requested() to try to make its meaning more clear
…ify true, nothing, or false. In this way, HDF5 files can be kept in special situations.
|
Sorry for the last-minute change. I realized that it might be helpful to request that HDF5 files be kept on disk in certain situations, despite what the integtest writer specified. (That's in addition to the ability to request that HDF5 files be deleted in certain situations.) |
eflumerf
left a comment
There was a problem hiding this comment.
My only question is if we want to make the cleanup a fixture that is always executed as a matter of course. This might be a bit restrictive, as we would want that to occur after all of the check_* functions, but put slightly less burden on integration test authors.
| os.system(f"ls -alF {filelist_string}") | ||
|
|
||
| for data_file in run_dunerc.data_files: | ||
| data_file.unlink() |
There was a problem hiding this comment.
Do we want a helper function that catches common errors and prints nicer messages?
def remove_file(file):
try:
file.unlink()
except FileNotFoundError:
print(f"Data file {file} was not found")
except IsADirectoryError:
print(f"Data file {file} is actually a directory")
Description
The primary change covered by this Pull Request is the addition of common utility that will remove HDF5 files at the end of each regression/integration test based on directives from within each integtest and from a command-line option that can be specified when each integtest is run.
Some additional changes that were made:
CreateConfigResultdata class were modified to try to make their meaning more clear--remove-hdf5-files" command-line option was addedutility_functions.py" file was added and the pre-existing "basic_checks" function was copied from a dedicated file into this "utility" file, with the goal of getting rid of that dedicated "basic_checks" file soonAs part of this work, corresponding changes were made to the integration tests in various repositories. Those changes are covered by the following PRs:
Here is a suggested set of steps for testing these changes:
For reference, here is a sample
pytest"test" that provides the hooks for removing (deleting) HDF5 files at the end of an integtest:The flag that is specified in the
remove_hdf5_files_if_requested()call is what the integrationtest developer feels is the best option. In any case, the presence of this function call in the integtest enables the ability for end users to request that the HDF5 files get removed by specifying the '--remove-hdf5-files' pytest option when the test is run.Type of change
Testing checklist
pytest -s minimal_system_quick_test.py)dunedaq_integtest_bundle.sh)